<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>新浪微博</title>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<style>
html {
    padding: 0px;
    margin: 0px;
}

body {
	color:#333;
	margin:0;
	padding:0;
	text-align:left;
	overflow:hidden;
	font-size:12px;
	background:#efefef;
}
#main{width:100%;height:195px;margin:0px;padding:10px}
*{font-family:微软雅黑,Trebuchet MS, Arial, Helvetica, Sans-Serif;font-size:12px}
*:focus {outline: 0;} 
ul,li{list-style:none;margin:0px;padding:0px}
fieldset{width:90%;-webkit-border-top-left-radius:3px;-webkit-border-top-right-radius:3px;-webkit-border-bottom-right-radius:3px;-webkit-border-bottom-left-radius:3px;}
legend{color:#000}
#main ul li{padding:2px;position:relative}

.btn_close{width:50px}
</style>
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script src="js/common.js?v=1.3"></script>

<script>
var load = 0;
$(document).ready(function(){
	if(load == 1){
		return false;
	}
	load = 1;
	$(".btn_close").click(function(){
		window.close();
	});
	saveSetRemindData();
	init();
	logOut();
});	

function init(){
	var userInfoData = {};
	var userInfoStr = localStorage.getItem("oauth2_userinfo");
	if(checkIfLocal(userInfoStr)){
		userInfoData = JSON.parse(userInfoStr);
	}
	var name = "未登录";
	if(userInfoData["name"]){
		name = userInfoData["name"];
	}
	$("#weibo_name").html(userInfoData["name"]);
	var settingStr = localStorage.getItem("_WEIBO_REMIND_SETTING");
	var settingData = {};
	if(checkIfLocal(settingStr)){
		settingData = JSON.parse(settingStr);
	}
	for(k in settingData){
		if(k == "remind_time"){
			$("#remind_time").val(settingData["remind_time"]);
		} else {
			if(settingData[k] == 1){
				$("#" + k).attr("checked", true);
			} else {
				$("#" + k).attr("checked", false);
			}
		}
	}
}

function logOut(){
	$(".btn_logout").click(function(){
		localStorage.setItem("home_weibo_list", "");
		localStorage.setItem("myweibo_list", "");
		localStorage.setItem("oauth2_accessToken", "");
		localStorage.setItem("oauth2_userinfo", "");
		alert("账户退出成功！");
		window.close();
	});
}

function saveSetRemindData(){
	$("#remind_setting ul li input").click(function(){
		setRemindData();
	});
	$("#remind_time").change(function(){
		setRemindData();
	});
}

function setRemindData(){
	var result = {};
	$("#remind_setting ul li input").each(function(){
		var value = 0;
		var name = $(this).attr("name");
		if($(this).attr("checked") == true){
			value = 1;
		}
		result[name] = value;
	});
	result["remind_time"] = $("#remind_time").val();
	localStorage.setItem("_WEIBO_REMIND_SETTING", JSON.stringify(result));
}

</script>
</head>
<body>
<div id="main">


<fieldset style="margin-top:20px">
<legend>提醒设置</legend>
<div id="remind_setting">
	<ul>
	<li><input type="checkbox" checked name="remind_pop" id="remind_pop" /><strong>浏览器弹泡提醒下列更新</strong></li>
	<li>&nbsp;&nbsp;<input type="checkbox" checked name="remind_comment" id="remind_comment" />新评论提醒</li>
	<li>&nbsp;&nbsp;<input type="checkbox" checked name="remind_fans" id="remind_fans" />新增粉丝提醒</li>
	<li>&nbsp;&nbsp;<input type="checkbox" checked name="remind_msg" id="remind_msg" />新私信提醒</li>
	<li>&nbsp;&nbsp;<input type="checkbox" checked name="remind_atme" id="remind_atme" />@提到我提醒</li>
	<li>刷新间隔：<select name="remind_time" id="remind_time"><option value=5>5分钟</option><option value=10>10分钟</option><option value=15>15分钟</option><option value=30>30分钟</option><option value=60>60分钟</option></select></li>
	<li><input type="checkbox" name="remind_stop" id="remind_stop" /><strong>暂停提醒</strong></li>
	</ul>
</div>
</fieldset>
<div style="text-align:right;width:90%;padding-top:10px;"><input type="button" value="关 闭" class="btn_close" /></div>
</div>
</body>
</html>